using System.IO;
using HybridCLR.Editor;
using UnityEditor;
using UnityEditor.Build.Player;
using UnityEngine;

namespace GameMain.Editor.BuildPipeline
{
    public partial class BuildPipeline
    {
        private static void CompileDll(string buildDir, BuildTarget target)
        {
            var group = UnityEditor.BuildPipeline.GetBuildTargetGroup(target);

            Directory.CreateDirectory(buildDir);
            var scr = PlayerBuildInterface.CompilePlayerScripts(new ScriptCompilationSettings
            {
                group = group,
                target = target
            }, buildDir);
            foreach (var ass in scr.assemblies)
            {
                Debug.Log($"[BuildPipeline::CompileDll] Compile assemblies:{buildDir}/{ass}");
            }
        }
    }
}
